import { postForm, get, put } from '@/utils/request'

// 获取列表
export function getRecords(listQuery) {
  return get('/platform/user/list/page', listQuery)
}

export function add(optData) {
  return postForm('/platform/user', optData)
}

export function edit(optData) {
  optData['pkId'] = optData.userId
  return put('/platform/user', optData)
}

export function editUserInfo(data) {
  return put('/platform/user/token', data)
}

export function del(ids) {
  return postForm('/platform/user/del/batch', { pkIds: JSON.stringify(ids) })
}

export function changeSelfPwd(user) {
  return postForm('/poly/user/changepwd/token', user)
}

export function changeUserIcon(icon) {
  return postForm('/platform/user/icon/token', { icon: icon })
}

export default { add, edit, del }
